Theory of Formal Languages